rootdir = $(realpath .)

#Here should be the path to the external libraries such as GL,glut,GLU,IL,ILU,ILUT, #boost_thread and freeimage if they are not in default location
EXTERN_LIBS_DIR=
CC=g++
LIBS=-lfreeimage -lglut -lGL -lGLU -lIL -lILU -lILUT -lboost_thread 
INCLUDES=-I"$(rootdir)/include" -I"$(rootdir)/lib"
SOURCEDIR=src
INCLUDELIBS=$(EXTERN_LIBS_DIR) $(LIBS) 
CFLAGS=-c $(INCLUDES) 
EXECUTABLE=CoolPool
LDFLAGS=
SOURCES=$(SOURCEDIR)/BallCollisionDetectors.cpp\
	$(SOURCEDIR)/Ball.cpp \
	$(SOURCEDIR)/BallRenderable.cpp \
	$(SOURCEDIR)/BoundingCylinder.cpp\
	$(SOURCEDIR)/CollisionDetectionWorkCollector.cpp\
	$(SOURCEDIR)/CollisionHandler.cpp\
	$(SOURCEDIR)/CollisionTimeFinder.cpp\
	$(SOURCEDIR)/Cue.cpp\
	$(SOURCEDIR)/CueGLPicker.cpp\
	$(SOURCEDIR)/Demo1.cpp\
	$(SOURCEDIR)/DetectionCheckWorker.cpp\
	$(SOURCEDIR)/DynamicEntity.cpp\
	$(SOURCEDIR)/EigenTools.cpp\
	$(SOURCEDIR)/EntitiesContainer.cpp\
	$(SOURCEDIR)/Entity.cpp\
	$(SOURCEDIR)/Game.cpp\
	$(SOURCEDIR)/GLCallbacks.cpp\
	$(SOURCEDIR)/GLPicker.cpp\
	$(SOURCEDIR)/GravityRigidBodySimulation.cpp\
	$(SOURCEDIR)/PointMass.cpp\
	$(SOURCEDIR)/Rectangle.cpp\
	$(SOURCEDIR)/RectangleRenderable.cpp\
	$(SOURCEDIR)/RigidBodyCollisionHandler.cpp\
	$(SOURCEDIR)/RigidBody.cpp\
	$(SOURCEDIR)/RigidBodyFriction.cpp\
	$(SOURCEDIR)/RigidBodyRestingContactHandler.cpp\
	$(SOURCEDIR)/RigidBodySimulation.cpp\
	$(SOURCEDIR)/Simulation.cpp\
	$(SOURCEDIR)/TimeMeasure.cpp\
	$(SOURCEDIR)/WorldGrid.cpp\
	$(SOURCEDIR)/Vector3D.cpp\
	$(SOURCEDIR)/MatrixTools.cpp\
	$(SOURCEDIR)/Ray3D.cpp\
	$(SOURCEDIR)/Plane.cpp

OBJECTS=$(SOURCES:.cpp=.o)


all:	$(SOURCES) $(EXECUTABLE)
	
$(EXECUTABLE): $(OBJECTS) 
	$(CC) $(LDFLAGS) $(OBJECTS) $(INCLUDELIBS) -o $@

.cpp.o:
	$(CC) $(CFLAGS) $< -o $@

clean:
	rm -rf ./src/*o CoolPool


